<?php
namespace Home\Controller;
class MessageController extends HomeController{
    
    /* 物流助手 */
    public function ship(){
        $p=I('p',1);
        (int)$p<=0 && $p=1;
        $pagesize=8;
        $offset=($p-1)*$pagesize;
        
        $M_message=M('message');
        $map=array();
        $map['uid']=UID;
        $map['type']=1;
        
        $total=$M_message->where($map)->count();
        $list=$M_message->where($map)->limit($offset,$pagesize)->select();
        foreach($list as &$item){
            $item['image_path']=get_cover($item['image_path'],'path');
        }
        $this->assign('list',$list);
        $__PAGE__ = new \Think\Page($total, $pagesize);
        
        $__PAGE__->lastSuffix = false;
        $__PAGE__->rollPage = 6;
        $__PAGE__->setConfig('prev', '<');
        $__PAGE__->setConfig('next', '>');
        $__PAGE__->setConfig('first', '<<');
        $__PAGE__->setConfig('last', '<span>...</span>');
        $__PAGE__->setConfig('header', '<span>共%TOTAL_PAGE%页</span>');
        $__PAGE__->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %END% %DOWN_PAGE% %HEADER%');
        
        $this->assign('_page', $__PAGE__->show());
        $this->display();
    }
    
    /* 交易信息 */
    public function trade(){
         $p=I('p',1);
        (int)$p<=0 && $p=1;
        $pagesize=8;
        $offset=($p-1)*$pagesize;
        
        $M_message=M('message');
        $map=array();
        $map['uid']=UID;
        $map['type']=2;
        
        $total=$M_message->where($map)->count();
        $list=$M_message->where($map)->limit($offset,$pagesize)->select();
        $this->assign('list',$list);
        foreach($list as &$item){
            $item['image_path']=get_cover($item['image_path'],'path');
        }
        $__PAGE__ = new \Think\Page($total, $pagesize);
        $__PAGE__->lastSuffix = false;
        $__PAGE__->rollPage = 6;
        $__PAGE__->setConfig('prev', '<');
        $__PAGE__->setConfig('next', '>');
        $__PAGE__->setConfig('first', '<<');
        $__PAGE__->setConfig('last', '<span>...</span>');
        $__PAGE__->setConfig('header', '<span>共%TOTAL_PAGE%页</span>');
        $__PAGE__->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %END% %DOWN_PAGE% %HEADER%');
        
        $this->assign('_page', $__PAGE__->show());
        $this->display();
    }
    
    /* 通知信息 */
    public function notice(){
         $p=I('p',1);
        (int)$p<=0 && $p=1;
        $pagesize=8;
        $offset=($p-1)*$pagesize;
        
        $M_message=M('message');
        $map=array();
        $map['uid']=UID;
        $map['type']=3;
        
        $total=$M_message->where($map)->count();
        $list=$M_message->where($map)->limit($offset,$pagesize)->select();
        foreach($list as &$item){
            $item['image_path']=get_cover($item['image_path'],'path');
        }
        $this->assign('list',$list);
        $__PAGE__ = new \Think\Page($total, $pagesize);
        $__PAGE__->lastSuffix = false;
        $__PAGE__->rollPage = 6;
        $__PAGE__->setConfig('prev', '<');
        $__PAGE__->setConfig('next', '>');
        $__PAGE__->setConfig('first', '<<');
        $__PAGE__->setConfig('last', '<span>...</span>');
        $__PAGE__->setConfig('header', '<span>共%TOTAL_PAGE%页</span>');
        $__PAGE__->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %END% %DOWN_PAGE% %HEADER%');
        
        $this->assign('_page', $__PAGE__->show());
        $this->display();
    }
    
    /* 定时消息 */
    public function timing(){
         $p=I('p',1);
        (int)$p<=0 && $p=1;
        $pagesize=8;
        $offset=($p-1)*$pagesize;
        
        $M_message=M('message');
        $map=array();
        $map['uid']=UID;
        $map['type']=4;
        
        $total=$M_message->where($map)->count();
        $list=$M_message->where($map)->limit($offset,$pagesize)->select();
        foreach($list as &$item){
            $item['image_path']=get_cover($item['image_path'],'path');
        }
        $this->assign('list',$list);
        $__PAGE__ = new \Think\Page($total, $pagesize);
        $__PAGE__->lastSuffix = false;
        $__PAGE__->rollPage = 6;
        $__PAGE__->setConfig('prev', '<');
        $__PAGE__->setConfig('next', '>');
        $__PAGE__->setConfig('first', '<<');
        $__PAGE__->setConfig('last', '<span>...</span>');
        $__PAGE__->setConfig('header', '<span>共%TOTAL_PAGE%页</span>');
        $__PAGE__->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %END% %DOWN_PAGE% %HEADER%');
        
        $this->assign('_page', $__PAGE__->show());
        $this->display();
    }
    
    /* 聚真宝活动 */
    public function activity(){
         $p=I('p',1);
        (int)$p<=0 && $p=1;
        $pagesize=8;
        $offset=($p-1)*$pagesize;
        
        $M_message=M('message');
        $map=array();
        $map['uid']=UID;
        $map['type']=5;
        
        $total=$M_message->where($map)->count();
        $list=$M_message->where($map)->limit($offset,$pagesize)->select();
        foreach($list as &$item){
        $item['image_path']=get_cover($item['image_path'],'path');
        }
        $this->assign('list',$list);
        $__PAGE__ = new \Think\Page($total, $pagesize);
        $__PAGE__->lastSuffix = false;
        $__PAGE__->rollPage = 6;
        $__PAGE__->setConfig('prev', '<');
        $__PAGE__->setConfig('next', '>');
        $__PAGE__->setConfig('first', '<<');
        $__PAGE__->setConfig('last', '<span>...</span>');
        $__PAGE__->setConfig('header', '<span>共%TOTAL_PAGE%页</span>');
        $__PAGE__->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %END% %DOWN_PAGE% %HEADER%');
        
        $this->assign('_page', $__PAGE__->show());
        $this->display();
    }
    
    /* 客户服务 */
    public function service(){
       
        $this->display();
    }
}

